package HomeWork.string;

public class StringBuilderDemo {
    public static void main(String[] args) {
        String s="This is a String sentence";
        StringBuilder sb=new StringBuilder(s);
        //append()
        System.out.println(sb.append(15134));
        //delete()  e.g. delete the word 'String' in the sentence
        int startL=s.indexOf('S');
        int endL=startL+7;
        System.out.println(sb.delete(startL,endL));
        //replace()
        System.out.println(sb.replace(5,7,"was"));
        //insert()
        System.out.println(sb.insert(sb.length()-5,"ffff"));
    }
}
